﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms;

using WpfApplication2.SindicatoWebService;
using WpfApplication2.ViewModels.Usuario;
using System.Windows.Threading;

namespace WpfApplication2.Views.Usuario
{
    /// <summary>
    /// Interaction logic for ActivarUsuario.xaml
    /// </summary>
    public partial class ActivarUsuario : Page
    {
        private UsuarioDTO Usuario
        {
            get;
            set;
        }

        NavigationService ns;

        public ActivarUsuario(UsuarioDTO usuario)
        {
            InitializeComponent();
            Usuario = usuario;
            ns = NavigationService.GetNavigationService(this);
            DataContext = new ActivarUsuarioViewModel(usuario, ns);
        }

        public void Activar(object sender, EventArgs e)
        {
            ActivarUsuarioViewModel VM = (ActivarUsuarioViewModel)DataContext;
            VM.ActivarUsuario.Execute(null);
        }

        private void Continuar(object sender, RoutedEventArgs e)
        {
            NavigationService.GetNavigationService(this).Navigate(new MainWindow(Usuario));
        }
    }
}
